package com.xingongchang.baolebei.protocol;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.external.activeandroid.Model;
import com.external.activeandroid.annotation.Column;
import com.external.activeandroid.annotation.Table;
import com.insthub.BeeFramework.model.BaseModel;
@Table(name = "Tuijian")
public class Tuijian extends BaseModel{
	  @Column(name = "goods_id")
	  public int good;
	  @Column(name = "goods_name")
	  public String goods_name;
	  @Column(name = "goods_img")
	  public String goods_img;
	  @Column(name = "goods_thumb")
	  public String goods_thumb;
	  public static Tuijian fromJson(JSONObject jsonObject) throws JSONException {
			if (null == jsonObject) {
				return null;
			}
			Tuijian localItem = new Tuijian();
			JSONArray subItemArray;
			localItem.good = jsonObject.optInt("goods_id");
			localItem.goods_name = jsonObject.optString("goods_name");
			localItem.goods_img = jsonObject.optString("goods_img");
			localItem.goods_thumb = jsonObject.optString("goods_thumb");
			return localItem;
		}

		public JSONObject toJson() throws JSONException {
			JSONObject localItemObject = new JSONObject();
			JSONArray itemJSONArray = new JSONArray();
			localItemObject.put("goods_id", good);
		    localItemObject.put("goods_name", goods_name);
			localItemObject.put("goods_img", goods_img);
			localItemObject.put("goods_thumb", goods_thumb);
			return localItemObject;
		}
}
